const Router = require("koa-router");
const { RegisterValidator } = require("../../validator/validator");
const {User} = require("../../../models/user")


const router = new Router({ prefix: "/v1/user" });

router.post("/register", async (ctx, next) => {
  const v = await new RegisterValidator().validate(ctx);

  const user = {
    nickname:v.get('body.nickname'),
      email:v.get('body.email'),
      password:v.get('body.password2'),

  }
  const res = await User.create(user)
  throw new global.errs.Success()
});


module.exports = router;
